package com.bootdo.lgs.main.service.impl;

import com.bootdo.lgs.main.dao.MainMapper;
import com.bootdo.lgs.main.model.EvaluateQuery;
import com.bootdo.lgs.main.service.MainService;
import com.bootdo.system.domain.UserDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class MainServiceImpl implements MainService {

    @Autowired
    private MainMapper mainMapper;

    @Override
    @Cacheable(cacheNames = "mainService.getEvaluate",keyGenerator = "keyGenerator")
    public List getEvaluate(UserDO loginUser) {
        Optional<String> lgsCompanyCd = Optional.ofNullable(loginUser.getLgsCompanyCd());
        EvaluateQuery evaluateQuery = new EvaluateQuery();
        evaluateQuery.setLgs_company_cd(lgsCompanyCd.orElse(null));//物流公司
        return mainMapper.getEvaluate(evaluateQuery);
    }

}
